'use strict';

angular.module('oaApp')
  .controller('NavbarCtrl', function ($scope, $location, Auth) {
    $scope.menu = [{
      'title': '首页',
      'icon': 'fa fa-home',
      'link': '/'
    },{
      'title': '时间轴',
      'icon': 'fa fa-clock-o',
      'link': '/timeline'
    },{
      'title': '人员',
      'icon': 'fa fa-user',
      'link': '/profiles'
    },{
      'title': '项目',
      'icon': 'fa fa-bar-chart',
      'link': '/projects'
    },{
      'title': '共享',
      'icon': 'fa fa-cloud',
      'link': '/shares'
    },{
      'title': '报告',
      'icon': 'fa fa-calendar',
      'link': '/reports'
    }];

    $scope.isCollapsed = true;
    $scope.isLoggedIn = Auth.isLoggedIn;
    $scope.isAdmin = Auth.isAdmin;
    $scope.getCurrentUser = Auth.getCurrentUser;

    $scope.logout = function() {
      Auth.logout();
      $location.path('/login');
    };

    $scope.isActive = function(route) {
      return route === $location.path();
    };
  });
